FROM jenkins/jenkins:latest
# FROM jenkins/jenkins:2.346.2-lts

USER root

LABEL MAINTAINER="GONSIN"
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install
ENV TZ=Asia/Shanghai
ENV LANG C.UTF-8

COPY sources.list /etc/apt/sources.list

RUN apt-get update
RUN apt-get install -y vim
RUN apt-get install -y wget
RUN apt-get install -y zip

## 安装java 11
# RUN wget http://update.gonsincloud.com/jenkins/jdk-8u231-linux-x64.tar.gz
# RUN tar zxvf jdk-8u231-linux-x64.tar.gz -C /usr/local/
# ENV JAVA_HOME /usr/local/jdk1.8.0_231
RUN wget https://mirrors.tuna.tsinghua.edu.cn/Adoptium/11/jdk/arm/linux/OpenJDK11U-jdk_arm_linux_hotspot_11.0.23_9.tar.gz
RUN mkdir /root/jenkins -p
RUN tar zxvf OpenJDK11U-jdk_arm_linux_hotspot_11.0.23_9.tar.gz -C /root/jenkins
RUN mv /root/jenkins/jdk-11.0.23+9 /root/jenkins/jdk -f


# 安装node npm
RUN wget http://update.gonsincloud.com/jenkins/node-v16.16.0-linux-x64.tar
RUN tar -xvf node-v16.16.0-linux-x64.tar -C /usr/local/
ENV NPM_HOME /usr/local/node-v16.16.0-linux-x64
ENV PATH $PATH:$NPM_HOME/bin
RUN npm -version

# 安装maven
RUN wget -nc http://update.gonsincloud.com/jenkins/apache-maven-3.6.2-bin.tar.gz
RUN tar zxvf apache-maven-3.6.2-bin.tar.gz -C /usr/local/
RUN cp /usr/local/apache-maven-3.6.2/conf/settings.xml /usr/local/apache-maven-3.6.2/conf/settings.xml.bk
COPY settings.xml /usr/local/apache-maven-3.6.2/conf/settings.xml
ENV MAVEN_HOME /usr/local/apache-maven-3.6.2
ENV PATH $PATH:$MAVEN_HOME/bin
RUN mvn -version

# 安装gradle
RUN wget -nc http://update.gonsincloud.com/jenkins/gradle-6.7.1-bin.zip
RUN unzip -d /usr/local/ gradle-6.7.1-bin.zip
RUN chmod 777 /usr/local/gradle-6.7.1/bin
ENV GRADLE_HOME /usr/local/gradle-6.7.1
ENV PATH $PATH:$GRADLE_HOME/bin
COPY init.gradle /usr/local/android/init.gradle
RUN gradle -version


# 安装python
RUN apt install -y python3
RUN python3 --version


## 安装qt

## 待补充
## 安装ffmpeg

# 安装nvm
RUN apt install git -y
RUN curl -o- http://update.gonsincloud.com/jenkins/install_nvm.sh | bash


## 安装qt
# COPY qt-opensource-linux-x64-5.14.0.run /usr/qt/qt-opensource-linux-x64-5.14.0.run
# RUN chmod 777 -R /usr/qt/qt-opensource-linux-x64-5.14.0.run
# RUN apt-get install dbus libx11-dev libx11-xcb-dev -y
# RUN ./usr/qt/qt-opensource-linux-x64-5.14.0.run

## 待补充
## 安装ffmpeg

# 添加国内插件地址
# RUN sed -i 's/http://updates.jenkins-ci.org/download/https://mirrors.tuna.tsinghua.edu.cn/jenkins/g' /var/jenkins_home/updates/default.json 
# RUN sed -i 's/http://www.google.com/https://www.baidu.com/g' /var/jenkins_home/updates/default.json
# RUN mkdir /var/jenkins_home/updates -p
# RUN wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json -O /var/jenkins_home/updates/default.json

# 安装nvm
RUN curl -o- http://update.gonsincloud.com/jenkins/install_nvm.sh | bash
ENV NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node/
# 安装node不同版本
# RUN nvm --no-use && NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node/ nvm install 14.20.1 && nvm use 14.20.1 

COPY default.json /var/jenkins_home/updates/default.json
WORKDIR /var/jenkins_home/


